import type { PostPatientConsultOrderParams } from '@/types/consult'
import { defineStore } from 'pinia'
import { ref } from 'vue'
export type IllnessInfoType = Pick<PostPatientConsultOrderParams, 'illnessDesc' | 'illnessTime' | 'consultFlag' | 'pictures'>
// 问诊信息
export const useConsultStore = defineStore(
	'consult',
	() => {
		// 初始化数据
		const initValue: IllnessInfoType = {
			illnessDesc: '',
			illnessTime: 1,
			consultFlag: 0,
			pictures: []
		}
		// 病情描述
		const illnessInfo = ref<IllnessInfoType>({ ...initValue })
		const type = ref('')
		const illnessType = ref('')
		const depId = ref('')

		// 患者id
		const patientId = ref('')

		// 重置store数据
		const reset = () => {
			illnessInfo.value = { ...initValue }
			type.value = ''
			illnessType.value = ''
			depId.value = ''
			patientId.value = ''
		}

		return { illnessInfo, type, illnessType, depId, patientId, reset }
	},
	{
		// 持久化
		persist: true
	}
)
